<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('物料分类列表')" />
</head>
<body class="gray-bg">
     <div class="container-div" onmousemove="parent.updateTimeOut()">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
<!--							<li>-->
<!--								编码：<input type="text" name="itemTypeCode"/>-->
<!--							</li>-->

							<li>
								名称：<input type="text" name="itemTypeName"/>
							</li>



<!--							<li>-->
<!--								父级ID：<input type="text" name="parentId"/>-->
<!--							</li>-->

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			


			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="system:itemType:add">
					<i class="fa fa-plus"></i> 新增
				</a>
				<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:itemType:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-info" id="expandAllBtn">
					<i class="fa fa-exchange"></i> 展开/折叠
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-tree-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:itemType:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:itemType:remove')}]];

		var datas = [[${@dict.getType('sys_show_hide')}]];

        var prefix = ctx + "system/itemType";

        $(function() {
            var options = {
				code: "itemTypeId",
				parentCode: "parentId",
				uniqueId: "itemTypeId",
                url: prefix + "/list",
                createUrl: prefix + "/add/{id}",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove/{id}",
                modalName: "物料分类",
                columns: [
                // {
		        //     checkbox: true
		        // },

				{
					field: 'selectItem',
					radio: true
				},

				// {
				// 	field : 'itemTypeId',
				// 	title : 'ID',
				// 	visible: false
				// },
				// {
				// 		field : 'parentId',
				// 		title : '父级ID',
				// 		visible: false
				// },

				{
					field : 'itemTypeName', 
					title : '物料名称',
					align: "left",
					sortable: true
				},
				{
					field: 'orderNum',
					title: '排序',
					width: '10%',
					align: "left"
				},

				{
					field : 'itemTypeCode',
					title : '编码',
					sortable: true
				},
				{
					field : 'parentName',
					title : '父级',
					align: "left",
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
						actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.add(\'' + row.itemTypeId + '\')"><i class="fa fa-edit"></i>新增下级</a> ');

						actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.itemTypeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.itemTypeId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
			$.treeTable.init(options);
        });
    </script>
</body>
</html>